var map;
var marker;
//var beijing = new google.maps.LatLng(39.92, 116.46);
var nju = new google.maps.LatLng(32.05529, 118.780349);

function initialize() {
	//控制作为背景的地图风格
	var mapStyle = [{
		//将建筑描边
		featureType : "landscape",
		elementType : "geometry.stroke",
		stylers : [{
			color : "#0F2F4F"
		}]
	}, {
		//改变文字标签颜色
		featureType : "all",
		elementType : "labels.text.fill",
		stylers : [{
			color : "#000000"
		}]
	}, {
		//将所有道路填充
		featureType : "road",
		elementType : "geometry.stroke",
		stylers : [{
			color : "#C79F70"
		}]
	}];
	
	//控制道路风格，提取道路
	var roadStyle = [{
		//关闭所有文字标签
		featureType : "all",
		elementType : "labels",
		stylers : [{
			visibility : "off"
		}]
	}, {
		//将其他元素设为不可见
		featureType : "landscape",
		elementType : "geometry",
		stylers : [{
			visibility : "off"
		}]
	}, {
		//将所有道路改为黑色
		featureType : "road",
		elementType : "geometry",
		stylers : [{
			color : "#000000"
		}]
	}];
	
	//普通地图初始化
	var mapOptions = {
		zoom : 17,
		center : nju,
		mapTypeId : google.maps.MapTypeId.ROADMAP,
		styles : mapStyle,
		//关闭所有控件
		mapTypeControl : false,
		zoomControl : false,
		panControl : false,
		rotateControl : false,
		streetViewControl : false,
	};
	
	//道路地图初始化
	var roadOptions = {
		zoom : 17,
		center : nju,
		mapTypeId : google.maps.MapTypeId.ROADMAP,
		styles : roadStyle,
		//关闭所有控件
		mapTypeControl : false,
		zoomControl : false,
		panControl : false,
		rotateControl : false,
		streetViewControl : false,
	};
	
	//将地图显示到页面
	map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
	map = new google.maps.Map(document.getElementById("road_canvas"), roadOptions);
}

/*
//这堆和这个项目没关，是我拿来测试和学习API的
function loadMarker() {
	var icon = new google.maps.MarkerImage("../images/frog.jpg");
	var markerOpts = {
		map : map,
		position : beijing,
		title : "helloworld",
		icon : icon
	};
	marker = new google.maps.Marker(markerOpts);
	google.maps.event.addListener(marker, 'click', showInfoWindow);
}

function showInfoWindow() {
	var infoWinOpts = {
		position : beijing,
		content : "<div style='color:red'>我是红色的，我是由html写出来的</div>"
	};
	var win = new google.maps.InfoWindow(infoWinOpts);
	win.open(map, marker);
}

function initStyler() {
	var newStyler = [{
		featureType : "road.local",
		elementType : "geometry",
		stylers : [{
			hue : "#00ff00"
		}, {
			saturation : 100
		}]
	}, {
		featureType : "landscape",
		elementType : "geometry",
		stylers : [{
			lightness : -100
		}]
	}];

	var styledMapOptions = {
		name : "Hip-Hop"
	}

	var myMapType = new google.maps.StyledMapType(newStyler, styledMapOptions);

	map.mapTypes.set('hiphop', myMapType);
	map.setMapTypeId('hiphop');
}
*/